"get.QDR" = function(sim.values, lag.vector){
		statistic.vector = NULL;
		pval.vector = NULL;
		df.vector = lag.vector;
		rk = NULL;
		uk = NULL;
		vark = NULL;
		Rt=rank(sim.values);
		n = length(sim.values);
		R.bar = (n+1)/2;
		R.normalizer = n*((n^2)-1)/12;
		for (k in 1:(n-1)){
			num.temp = 0;
			for (t in 1:(n-k)){
				num.temp = num.temp + (Rt[t]-R.bar)*(Rt[t+k]-R.bar);
			}			
			rk = c(rk,num.temp/R.normalizer);
			uk = c(uk,-(n-k)/(n*(n-1)));
			vark = c(vark,(5*n^4 - (5*k+9)*n^3 + 9*(k-2)*n^2 + 2*k*(5*k+8)*n+16*(k^2))/(5*((n-1)^2)*(n^2)*(n+1)));			
		}

		for (i in 1:length(lag.vector)){
			statistic.temp = 0
			for(k in 1:lag.vector[i]){
				statistic.temp = statistic.temp + (((rk[k]-uk[k])^2)/vark[k]);			
			}
			statistic.vector = c(statistic.vector,statistic.temp);
			pval.vector = c(pval.vector,1-pchisq(statistic.temp,lag.vector[i]));
		}
	return(structure(list(name = "QDR",STATISTIC = statistic.vector,lags=lag.vector,PVAL=pval.vector,df=df.vector)));
}